וַיְדַבֵּ֤ר דָּוִד֙ לַֽיהוָ֔ה אֶת־דִּבְרֵ֖י הַשִּׁירָ֣ה הַזֹּ֑את בְּיוֹם֩ הִצִּ֨יל יְהוָ֥ה אֹת֛וֹ מִכַּ֥ף כָּל־אֹיְבָ֖יו וּמִכַּ֥ף שָׁאֽוּל׃
And David spoke unto the LORD the words of this song in the day that the LORD delivered him out of the hand of all his enemies, and out of the hand of Saul;
Read halakhic rulings (Jewish law) on II Samuel 22:1: and classical halakhic sources.